import React from 'react'
import { connect } from 'react-redux'

const PageB= ({age , fn}) => {
  return (
    <div>
      <h2>PageB-{age}</h2>
      <button onClick={fn}>点击修改age</button>
    </div>
  )
}

export default connect(
  (state) => {
    return {
      age: state.age
    }
  },

  (dispatch) => {
    return {
      fn () {
        dispatch({
          type: 'CHANGE_AGE', 
          age: 20
        })
      }
    }
  }
)(PageB)